home *** CD-ROM | disk | FTP | other *** search
/ Best of Shareware / Best of PC Windows Shareware 1.0 - Wayzata Technology (7111) (1993).iso / mac / DOS / CAD_CAM / A7221V1B / HPCODES.H < prev    next >
C/C++ Source or Header  |  1992-03-12  |  6KB  |  177 lines

  1. /*
  2.    Module:  hpcodes.h
  3.    Date:    3/9/92
  4.    Version: 1.0
  5.    Author:  Dave Lutz
  6.    Email:   lutz@psych.rochester.edu
  7.    Copyright: 1992 University of Rochester, Psychology Dept.
  8.  
  9.    Disclaimer:  This software is distributed free of charge.  As such, it
  10.                 comes with ABSOLUTELY NO WARRANTY.  The user of the software
  11.                 assumes ALL RISKS associated with its use.
  12.  
  13.                 Your rights to modify and/or distribute this software are
  14.                 outlined in the file ADI7221.DOC.
  15.  
  16.    Purpose: This module provides the code definitions for HP 7221 plotting
  17.             devices.  These codes can be used to convert an AutoCad ADI
  18.             file to a file that can be sent directly to the plotter for
  19.             plotting.
  20.  
  21.             The codes in this file work for either the 7221A (4 pen plotter)
  22.             or the 7221C (10 pen plotter).  They would probably work for
  23.             any plotter in the 7221 series, but that has not been verified.
  24. */
  25.  
  26. /* maximum pen speed setting */
  27. #define HP_MAXSPEED 36
  28.  
  29. /* HP_BEGINPLOT actually just sends the pen to the upper right grid point */
  30. #define HP_BEGINPLOT "pb>@_P}"
  31. #define HPBP_BYTES   7
  32. /* HP_ENDPLOT actually just sends the pen to the upper right grid point */
  33. #define HP_ENDPLOT   "pb>@_P}"
  34. #define HPEP_BYTES   7
  35. #define HP_MOVE      "p"
  36. #define HPM_BYTES    1
  37. #define HP_END_MOVE  "}"
  38. #define HPEM_BYTES   1
  39. #define HP_DRAW      "q"
  40. #define HPD_BYTES    1
  41. #define HP_END_DRAW  "}"
  42. #define HPED_BYTES   1
  43. #define HP_NEWPEN    "v"
  44. #define HPNP_BYTES   1
  45. #define HP_SETSPEED  "~V"
  46. #define HPSS_BYTES   2
  47. #ifdef VARIABLE_DASHES
  48. # define HP_LINETYPE "~R"
  49. # define HPLT_BYTES  2
  50. #else
  51. # define HP_LINETYPE "~Q"
  52. # define HPLT_BYTES  2
  53. #endif
  54. /* PEN_CHANGE is really just a pen up command. */
  55. #define HP_PENCHANGE "p}"
  56. #define HPPC_BYTES   2
  57. /* 
  58.    HP_ABORTPLOT is empty because it should never actually be called.  If a
  59.    plot is aborted in AutoCad while it is being sent to a file, AutoCad will
  60.    not create the file.
  61. */
  62. #define HP_ABORTPLOT ""
  63. #define HPAP_BYTES   0
  64.  
  65. /*
  66.   The following section contains the defines for the individual line types.
  67.   If you want to modify these, you should probably read the HP manual, but
  68.   I've included some pointers here to make things a little easier.
  69.  
  70.   To define a line type, you specify the pattern of dashes, dots, and spaces
  71.   that are to be used, and then specify the length (in plotter units) for the
  72.   entire pattern.  I based the following line types on the assumption that
  73.   a dash of length 1 should use 10 plotter units.  This was done partly
  74.   because I like that length, and partly because working with 10's is easier.
  75.  
  76.   For example, the longest pattern (PHANTOM), looks like this:
  77.  
  78.         '----- - - '
  79.  
  80.   This pattern has can be divided into 10 units of length 1, so the length
  81.   of the pattern is 100 plotter units.
  82.  
  83.   When the pattern is specified, you have to add 32 to the length of a dash
  84.   so that it can be differentiated from a space.  This results in the
  85.   following pattern specification:
  86.  
  87.        37 1 33 1 33 1
  88.  
  89.   To specify the code for the #define, the numbers in the pattern spec must
  90.   be converted to SBN format.  I've already done this for dots, dashes up to
  91.   length 10, and spaces up to length 10.  You can find them in the table
  92.   shown below.
  93.  
  94.         SBN code for Dot = SPACE
  95.  
  96.         SBN codes for Dashes and Spaces
  97.  
  98.      Length   Dash  Space
  99.              +-----------+
  100.        1     |  !  |  A  |
  101.        2     |  "  |  B  |
  102.        3     |  #  |  C  |
  103.        4     |  $  |  D  |
  104.        5     |  %  |  E  |
  105.        6     |  &  |  F  |
  106.        7     |  '  |  G  |
  107.        8     |  (  |  H  |
  108.        9     |  )  |  I  |
  109.       10     |  *  |  J  |
  110.              +-----------+
  111.  
  112.   When specifying the length of the pattern, you must convert that length
  113.   to MBN format.  To simplify this procedure, I've converted all multiples
  114.   of 10 from 20 to 150.  You can find them in the table shown below.
  115.  
  116.         MBN codes for lengths 20 - 150 (step 10)
  117.  
  118.            20  `T
  119.            30  `^
  120.            40  `(
  121.            50  `2
  122.            60  `<
  123.            70  aF
  124.            80  aP
  125.            90  aZ
  126.           100  a$
  127.           110  a.
  128.           120  a8
  129.           130  bB
  130.           140  bL
  131.           150  bV
  132.  
  133.   As you can see from the above table, you will have to do the math by hand
  134.   if you want lengths that are not multiples of 10 (ie there is no easy
  135.   pattern to the second character in each code).
  136.  
  137.   When you look at the following #defines remember that the last two chars
  138.   in each #define represent the length of the pattern in plotter units.  If
  139.   you modify these, and end up with a plotter unit length that requires more
  140.   than two chars, you should probably include a comment indicating that
  141.   fact.
  142.   
  143.   There is a name_BYTES #defined for each pattern. This specifies the total 
  144.   number of bytes used in the string that will be sent to the plotter.  This 
  145.   can be passed to funtions that need to know the byte counts, saving you 
  146.   from calculating it each time the codes are used.
  147.   
  148.   Now for the codes...
  149. */
  150.  
  151. #define LT_SOLID     "" /* solid is the default, thus a NULL string */
  152. #define LTS_BYTES    0
  153.  
  154. #define LT_DASHED    "\"A`^"
  155. #define LTDA_BYTES    4
  156.  
  157. #define LT_HIDDEN    "!A`T"
  158. #define LTH_BYTES    4
  159.  
  160. #define LT_CENTER    "$A!AaF"
  161. #define LTC_BYTES    6
  162.  
  163. #define LT_PHANTOM   "%A!A!Aa$"
  164. #define LTP_BYTES    8
  165.  
  166. #define LT_DOT       " A`T"
  167. #define LTDO_BYTES   4
  168.  
  169. #define LT_DASHDOT   "\" A`("
  170. #define LTDD_BYTES   5
  171.  
  172. #define LT_BORDER    "\"A\"A AaP"
  173. #define LTB_BYTES    8
  174.  
  175. #define LT_DIVIDE    "\"A A AaF"
  176. #define LTDI_BYTES   8
  177.